<template>
  <div>
    <Form :validOnChange="true" :model="model">
      <FormItem label="响应格式">
        <Select :datas="dataType" v-model="model.dataType"></Select>
      </FormItem>
      <FormItem label="响应码">
        <input v-model="model.successCode" type="text" />
      </FormItem>
      <FormItem label="数据域名">
        <input v-model="model.dataKey" type="text" />
      </FormItem>
    </Form>
    <div slot="footer">
      <Button :block="true" text-color="primary" @click="save">确认</Button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      model: {
        successCode: "",
        dataKey: "",
      },
      param: {
        keyName: "keyId",
        titleName: "title",
      },
      dataType: [
        { keyId: "all", title: "复合类型" },
        { keyId: "list", title: "JSON集合" },
        { keyId: "object", title: "JSON对象" },
        { keyId: "string", title: "字符文本" },
        { keyId: "bytes", title: "文件流" },
      ],
    };
  },
  methods: {
    responseInit(data) {
      if (!!data) {
        this.model = data;
      }
    },
    save() {
      console.log(this.model);
      this.$emit("setContent", this.model);
    },
  },
  deactivated() {
    this.$destroy(true);
  },
};
</script>
